package com.jason.seckill.utils;

import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.stereotype.Component;

@Component
public class MD5Util {
    private static final String salt = "1a2b3c4d";

    public static String md5(String src) {
        return DigestUtils.md5Hex(src);
    }

    public static String passChange(String inputPass) {
        String str = "" + salt + inputPass;
        return md5(str);
    }

    public static String passChange2(String password, String salt) {
        String str = "" + salt + password;
        return md5(str);
    }

    public static String realPass(String password, String salt) {
        String s = passChange(password);
        String realPass = passChange2(s, salt);
        return realPass;
    }

    public static void main(String[] args) {
        System.out.println(passChange("123123"));
        System.out.println(passChange2("3d17ec91339be67055dc64482f611912", salt));
        System.out.println(realPass("123123", salt));
    }
}
